<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta http-equiv="X-UA-Compatible" content="IE=dege"/>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		
	</head>
	<body>
		<button onclick="positionClick()">获得房前位置</button>
	</body>
	<script type="text/javascript">
//		navigator 浏览器

function positionClick () {
	  if(!navigator.geolocation){
      alert("你的浏览器不支持定位功能")
   }else{
   	//getCurrentPosition获得当前位置
   	navigator.geolocation.getCurrentPosition(function  (pos) {
   		var obj = JSON.stringify(pos)
   		alert(obj)
   	},function  (err) {
   		alert(JSON.stringify(err));
   	})
   }
}

 
  
	</script>
</html>
